﻿using System.ComponentModel.DataAnnotations.Schema;
using System.ComponentModel.DataAnnotations;
using System;

namespace PhotinoNote.Entities
{
    public class Note
    {
        [Key]
        [DatabaseGenerated(DatabaseGeneratedOption.Identity)]
        public long Id { get; set; }

        [Required]
        [StringLength(255)]
        public string Title { get; set; }

        [Required]
        public string Content { get; set; }

        public DateTime CreateAt { get; set; } = DateTime.Now;
        public DateTime UpdateAt { get; set; } = DateTime.Now;
        public DateTime? DeleteAt { get; set; }

        // 一对多反向
        public long NotebookId { get; set; }
        public Notebook Notebook { get; set; } = null!;


        public Note(string title, string content)
        {
            this.Title = title;
            this.Content = content;
        }
        public Note(string title, string content, DateTime createAt)
        {
            this.Title = title;
            this.Content = content;
            this.CreateAt = createAt;
        }
    }
}
